package com.xiaoma.eventpublish;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Test {

    public static void main(String[] args) {
        //创建springIOC容器
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(BeanConfig.class);
        //从容器中获取事件发布器实例
        BusinessPublisher businessPublisher = applicationContext.getBean(BusinessPublisher.class);
        //创建事件
        BusinessEvent businessEvent = new BusinessEvent(new Test(), "ALLOT");
        //发布事件
        businessPublisher.publishEvent(businessEvent);
    }
}
